<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:p="http://primefaces.org/ui"
	xmlns:pe="http://primefaces.org/ui/extensions" >
<h:head>
	<title>List Base Products</title>
</h:head>
<h:body>
	<h:link value="PERSONAL HOME" outcome="index" />
	<h:panelGrid columns="3">
      	<h:link value="Add hotel" outcome="addHotel" />
      	<h:link value="Add transport" outcome="addTransport" />
      	<h:link value="Add excursion" outcome="addExcursion" />
	</h:panelGrid>
	<br />
 	<h:form id="formView">
		<f:event type="preRenderView" listener="#{listBaseProducts.init()}" />
	
        <p:dataTable id="dataTableHotel" var="hotel" value="#{listBaseProducts.hotels}"  
                 paginator="true" rows="15" rowKey="#{hotel.id}" dblClickSelect="false"
                 selectionMode="single" selection="#{listBaseProducts.selectedHotel}"
                 paginatorTemplate="{CurrentPageReport} {FirstPageLink} {PreviousPageLink}
                 {PageLinks} {NextPageLink} {LastPageLink}" >
     	
        <p:ajax event="rowSelect" listener="#{listBaseProducts.onHotelRowSelectNavigate}" />
        
        <f:facet name="header">  
            List hotels
        </f:facet>  
  
        <p:column sortBy="id" headerText="ID">  
            <h:outputText value="#{hotel.id}" />  
        </p:column>  
  
        <p:column headerText="Description">
            <p:inputTextarea value="#{hotel.description}" rows="2" cols="15"
            	readonly="true" autoResize="false" />  
        </p:column>  
  
        <p:column sortBy="startTrip" headerText="Begin date">
            <h:outputText value="#{hotel.startTrip}" >
            	<f:convertDateTime pattern="dd/MM/yyyy HH:mm" timeZone="GMT+1"/>
            </h:outputText> 
        </p:column>
        
         <p:column sortBy="endTrip" headerText="End date">
            <h:outputText value="#{hotel.endTrip}" >
            	<f:convertDateTime pattern="dd/MM/yyyy HH:mm" timeZone="GMT+1"/>
            </h:outputText>  
        </p:column>
        
        <p:column sortBy="price" headerText="Price">
            <h:outputText value="#{hotel.price} €" />  
        </p:column>
        
        <p:column sortBy="maxAvailability" headerText="Max availability">
            <h:outputText value="#{hotel.maxAvailability}" />  
        </p:column>
        
         <p:column sortBy="reservations" headerText="Current reservations">
            <h:outputText value="#{hotel.reservations}" />  
        </p:column>
        
        <f:facet name="footer">  
              Total hotels: #{listBaseProducts.hotels.size()}
        </f:facet>
    	</p:dataTable>
    	<br />
    	<p:dataTable id="dataTableTransport" var="transport" value="#{listBaseProducts.transports}"  
                 paginator="true" rows="15" rowKey="#{transport.id}" dblClickSelect="false"
                 selectionMode="single" selection="#{listBaseProducts.selectedTransport}"
                 paginatorTemplate="{CurrentPageReport} {FirstPageLink} {PreviousPageLink}
                 {PageLinks} {NextPageLink} {LastPageLink}" >
        
        <p:ajax event="rowSelect" listener="#{listBaseProducts.onTransportRowSelectNavigate}" />
        
        <f:facet name="header">  
            List transports
        </f:facet>  
  
        <p:column sortBy="id" headerText="ID">  
            <h:outputText value="#{transport.id}" />  
        </p:column>  
  
        <p:column headerText="Description">
           	<p:inputTextarea value="#{transport.description}" rows="2" cols="15"
            	readonly="true" autoResize="false" />  
        </p:column>  
  
        <p:column sortBy="startTrip" headerText="Begin date">
            <h:outputText value="#{transport.startTrip}" >
            	<f:convertDateTime pattern="dd/MM/yyyy HH:mm" timeZone="GMT+1"/>
            </h:outputText>  
        </p:column>
        
         <p:column sortBy="endTrip" headerText="End date">
            <h:outputText value="#{transport.endTrip}" >
            	<f:convertDateTime pattern="dd/MM/yyyy HH:mm" timeZone="GMT+1"/>
            </h:outputText>  
        </p:column>
        
        <p:column sortBy="price" headerText="Price">
            <h:outputText value="#{transport.price} €" />  
        </p:column>
        
        <p:column sortBy="maxAvailability" headerText="Max availability">
            <h:outputText value="#{transport.maxAvailability}" />  
        </p:column>
        
         <p:column sortBy="reservations" headerText="Current reservations">
            <h:outputText value="#{transport.reservations}" />  
        </p:column>
        
        <f:facet name="footer">  
              Total transports: #{listBaseProducts.transports.size()}
        </f:facet>
    	</p:dataTable>
    	<br />
    	<p:dataTable id="dataTableExcursion" var="excursion" value="#{listBaseProducts.excursions}"  
                 paginator="true" rows="15" rowKey="#{excursion.id}" dblClickSelect="false"
                 selectionMode="single" selection="#{listBaseProducts.selectedExcursion}"
                 paginatorTemplate="{CurrentPageReport} {FirstPageLink} {PreviousPageLink}
                 {PageLinks} {NextPageLink} {LastPageLink}" >
        
        <p:ajax event="rowSelect" listener="#{listBaseProducts.onExcursionRowSelectNavigate}" />
        
        <f:facet name="header">  
            List excursions
        </f:facet>  
  
        <p:column sortBy="id" headerText="ID">  
            <h:outputText value="#{excursion.id}" />  
        </p:column>  
  
        <p:column headerText="Description">
           	<p:inputTextarea value="#{excursion.description}" rows="2" cols="15"
            	readonly="true" autoResize="false" /> 
        </p:column>  
  
        <p:column sortBy="startTrip" headerText="Begin date">
            <h:outputText value="#{excursion.startTrip}" >
            	<f:convertDateTime pattern="dd/MM/yyyy HH:mm" timeZone="GMT+1"/>
            </h:outputText>  
        </p:column>
        
         <p:column sortBy="endTrip" headerText="End date">
            <h:outputText value="#{excursion.endTrip}" >
            	<f:convertDateTime pattern="dd/MM/yyyy HH:mm" timeZone="GMT+1"/>
            </h:outputText>  
        </p:column>
        
        <p:column sortBy="price" headerText="Price">
            <h:outputText value="#{excursion.price} €" />  
        </p:column>
        
        <p:column sortBy="maxAvailability" headerText="Max availability">
            <h:outputText value="#{excursion.maxAvailability}" />  
        </p:column>
        
         <p:column sortBy="reservations" headerText="Current reservations">
            <h:outputText value="#{excursion.reservations}" />  
        </p:column>
        
        <f:facet name="footer">  
              Total excursions: #{listBaseProducts.excursions.size()}
        </f:facet>
    	</p:dataTable>
	</h:form>
</h:body>
</html>